package edu.tju.dorm;

import java.sql.SQLException;

import java.util.List;

import com.ibatis.sqlmap.client.SqlMapClient;
import com.younker.waf.db.IBatisConfig;


public class IbatisStudentDormDao implements IStudentDormDao{
	protected SqlMapClient sqlMap = IBatisConfig.getSqlMapInstance();



	
	public void deleteStudentDorm(long id) throws SQLException {
		
		sqlMap.delete("deleteStudentDorm", id);
	}

	@SuppressWarnings("unchecked")
	
	public List<StudentDorm> getStudentDormAnd(StudentDorm studentDorm)
			throws SQLException {
		
		return sqlMap.queryForList("getStudentDormAnd", studentDorm);
	}

	
	public StudentDorm getStudentDormById(long id) throws SQLException {
		
		return (StudentDorm) sqlMap.queryForObject("getStudentDormById", id);
	}

	
	public List<StudentDorm> getStudentDormOr(StudentDorm studentDorm)
			throws SQLException {
		// TODO Auto-generated method stub
		return null;
	}

	
	public Long insertStudentDorm(StudentDorm studentDorm) throws SQLException {
	
		 return (Long)sqlMap.insert("insertStudentDorm", studentDorm); 
	}

	
	public int updateStudentDorm(StudentDorm studentDorm) throws SQLException {
		
		return  sqlMap.update("updateStudentDorm", studentDorm);
	}

}
